package com.xshang.controller.frontend;

import com.xshang.entity.dto.MainPageInfoDTO;
import com.xshang.entity.dto.Result;
import com.xshang.service.combine.HeadLineShopCategoryCombineService;
import lombok.Getter;
import org.simplespringframework.annotation.Controller;
import org.simplespringframework.inject.annotation.Autowired;
import org.simplespringframework.mvc.annotation.RequestMapping;
import org.simplespringframework.mvc.type.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @BelongsProject: simpleframework
 * @BelongsPackage: com.xshang.controller.frontend
 * @Author: xshang
 * @CreateTime: 2023-06-23  18:12
 * @Description: TODO
 * @Version: 1.0
 */
@Controller
@Getter
@RequestMapping(value = "/main")
public class MainPageController {

    @Autowired
    private HeadLineShopCategoryCombineService headLineShopCategoryCombineService;

    public Result<MainPageInfoDTO> getMainPageInfo(HttpServletRequest request, HttpServletResponse response) {
        return headLineShopCategoryCombineService.getMainPageInfo();
    }


    @RequestMapping(value = "/error", method = RequestMethod.GET)
    public void throwException() {
        throw new RuntimeException("这是我手动抛出的一个运行时异常，用于测试内部异常渲染器");
    }

}
